package com.spring.learn.springboot.learn02;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
import org.springframework.stereotype.Component;

/**
 * Created by bgt on 2018/5/1.
 */
@Component
public class BeanFactoryPostDemo implements BeanFactoryPostProcessor {
    /**
     * bean工厂处理完毕后的操作
     * 在bean装载完毕  beanpost before之前触发
     * @param beanFactory
     * @throws BeansException
     */
    @Override
    public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
        String[] res=beanFactory.getBeanDefinitionNames();
        System.out.println("所有的beanNames:");
        for (String name:res) {
            System.out.print(name+",");
        }
    }
}
